﻿using ETask.Api.Models;
using System.ComponentModel.DataAnnotations;

namespace ETask.Api.Dtos
{
    public class DeptDto
    {
        public int Id { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsDeleted { get; set; } = false;

        /// <summary>
        /// 部门名称
        /// </summary>
        public string DeptName { get; set; }

        /// <summary>
        /// 部门编码
        /// </summary>
        public string DeptCode { get; set; }

        /// <summary>
        /// 上级部门编码
        /// </summary>
        public string ParentDeptCode { get; set; }

        /// <summary>
        /// 子部门列表
        /// </summary>
        public List<DeptDto> Children { get; set; } = new List<DeptDto>();
    }

    public class CreateDeptDto
    {
        [Required(ErrorMessage = "部门名称不能为空")]
        public string DeptName { get; set; }

        public string ? DeptCode { get; set; }

        public string ? ParentDeptCode { get; set; }
    }

    public class UpdateDeptDto
    {

        public int Id { get; set; }

        [Required(ErrorMessage = "部门名称不能为空")]
        public string DeptName { get; set; }
    }

    public class DeptListParams
    {
        public string? KeyWord { get; set; }

        public PaginationParameters PageDto { get; set; }
    }
}
